package com.yupi.yupicturebackend.manager.websocket.model;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;

@Getter
public enum PictureEditActionEnum {
    ZOOM_IN("放大操作", "ZOOM_IN"),
    ZOOM_OUT("缩小操作", "ZOOM_OUT"),
    ROTATE_LEFT("左旋转操作", "ROTATE_LEFT"),
    ROTATE_RIGHT("右旋转操作", "ROTATE_RIGHT");

    private final String text;
    private final String value;

    PictureEditActionEnum(String text, String value) {
        this.text  = text;
        this.value = value;
    }

    /**
     * 根据值获取枚举
     * @param value
     * @return
     */
    public static PictureEditActionEnum getByValue(String value) {
        if (StrUtil.isBlank(value)) {
            return null;
        }
        for (PictureEditActionEnum action : PictureEditActionEnum.values()) {
            if (action.value.equals(value)) {
                return action;
            }
        }
        return null;
    }
}
